﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;

namespace Day1
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void bnt01_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Hello World");
        }

        private void bnt02_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Hello World");
        }

        private void bnt03_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show("Hello World");
        }

        private void bnt04_Click(object sender, RoutedEventArgs e)
        {
            MessageBox.Show(txt01.Text);
            
        }

        private void bntAdd_Click(object sender, RoutedEventArgs e)
        {
            Button bnt05 = new Button();
            bnt05.Content = "Show My Text";
            bnt05.Click += new RoutedEventHandler(bnt05_Click);

            TextBox txt02 = new TextBox();
            txt02.Text = "";
            myStackPanel.Children.Add(txt02);
            myStackPanel.Children.Add(bnt05);
        }

        void bnt05_Click(object sender, RoutedEventArgs e)
        {
            TextBox t =(TextBox)  myStackPanel.Children[7];
            MessageBox.Show(t.Text);
            MessageBox.Show(t.Name);
        }

        private void bntDemoGrid_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/DemoGrid.xaml",
                UriKind.RelativeOrAbsolute));
        }

        private void bntDemoCanvas_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/DemoCanvas.xaml",
                UriKind.RelativeOrAbsolute));
        }
    }
}